package com.ken.checkviolationapp.adapter

import android.content.Context
import com.cimcitech.tebaoscreen.base.BaseHolder
import com.cimcitech.tebaoscreen.base.BaseRecyclerViewAdapter
import com.ken.base_http_library.Detail
import com.ken.checkviolationapp.R

/**
 * @author by ken
 * Blog:
 * Date:2020/4/28
 * Description:
 */
class ViolationsAdapter(ctx: Context, layoutRes: Int, mData: MutableList<Detail>) :
    BaseRecyclerViewAdapter<Detail>(
        ctx,
        R.layout.item_violations, mData
    ) {

    override fun convert(holder: BaseHolder, item: Detail, position: Int) {
        holder.setText(R.id.tvTime, "违章时间:" + item.vio_time)
        holder.setText(R.id.tvAddress, "违章地址:" + item.vio_address)
        holder.setText(R.id.tvAction, "违章行为:" + item.vio_action)
        holder.setText(R.id.tvfine, "违章罚款:" + item.vio_fine)
        holder.setText(R.id.tvScore, "违章记分:" + item.vio_score)
        holder.setText(R.id.tvCityName, "所在城市:" + item.vio_city_name)
        holder.setText(R.id.tvOrgan, "采集机构:" + item.col_organ)
        holder.setText(R.id.tvDecisionNum, "决定书编号:" + item.decision_num)
        holder.setText(R.id.tvMonitorNum, "监控编号:" + item.monitor_num)
        var handleSign: String = when (item.handle_sign) {
            1 -> {
                "未处理 未缴费"
            }
            2 -> {
                "已处理 未缴费"
            }
            3 -> {
                "已处理 已缴费"
            }

            else -> {
                "未处理 未缴费"
            }
        }
        holder.setText(R.id.tvHandleSign, "处理标记:$handleSign")
        holder.setText(R.id.tvHandleNum, "处理编号:" + item.handle_num)
        holder.setText(
            R.id.tvOnlineHandle,
            "在线处理:" + (if (item.online_handle.equals("1")) "可以处理" else "不支持处理")
        )
    }
}